<%@page import="org.madmac.placaRede.PasswordDelMac"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
			pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.Date"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.text.SimpleDateFormat"%>
<!-- VERIFICA SE O USUÁRIO ESTÁ COM O COOKIE VÁLIDO, SENÃO O REDIRECIONA PARA A PÁGINA DE LOGIN -->
<%@ include file="/log/verify_login.jsp" %>
<!-- VERIFICA SE O USUÁRIO TEM PERMISSÃO DE ACESSAR A PÁGINA, SENÃO REDIRECIONA PARA A PÁGINA INICIAL -->
<%@include file="/log/adm_page.jsp" %>

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Remover Endereço MAC</title>
      <link rel="icon" href="/madmac/favicon.ico" type="image/x-icon" />
      <link rel="shortcut icon" href="/madmac/favicon.ico" type="image/x-icon" />
      <link rel="stylesheet" href="/madmac/menu_madmac_files/cbcscbmenu_madmac.css" type="text/css" />
		<link rel="stylesheet" href="/madmac/estilos/madmac_tables.css" type="text/css" />
      <link rel="stylesheet" href="/madmac/estilos/madmac_inputs.css" type="text/css" />
		<link rel="stylesheet" href="/madmac/estilos/madmac_others.css" type="text/css" />
      <script type="text/javascript" src="/madmac/madmacproject.js"></script>
   </head>
   <body onload="document.getElementById('mac').focus()">
      <div class="logotype"><img src="/madmac/madmac-logo-1.0.1.png" height="120%" alt="MAD MAC"></div>

      <div class="menu_principal">
			<%@ include file="/common_pages/menu.jsp" %>
      </div>

      <div class="search_mac">
			<%@include file="/common_pages/search_mac.jsp" %>
      </div>

      <div class="corpo">
			<p><br/><br/></p>

			<form name="remove_mac" method="post" action="/madmac/mac/delete_mac.jsp" onreset="document.getElementById('mac').focus()">
				<table width="50%" align="center" border="0" cellpadding="12" cellspacing="0" rules="all" class="main_table">
					<tr>
						<td width="5%"></td>
						<td class="meta_cell">Endereço MAC</td>
						<td class="data_cell">
							<input type="text" name="mac" value="" maxlength="17" id="mac"
									 class="input_fields" style="text-transform:lowercase"
									 title=" Digite o endereço MAC que deseja remover " /></td>
						<td width="5%"></td>
					</tr>
					<tr>
						<td></td>
						<td class="meta_cell">Master Password</td>
						<td class="data_cell">
							<input type="password" name="master_passwd" value="" maxlength="40" id="passwd" class="input_fields" /></td>
						<td class="cmd_cell" align="center">
							<img src="/madmac/icons/new_passwd.png" border="0" title=" Criar nova senha " alt="">
						</td>
					</tr>
				</table>
				<br/>
				<table width="50%" align="center" border="1" cellpadding="15" cellspacing="0" rules="rows" class="main_table">
               <tr class="menu_sql">
                  <td></td>
                  <td align="center">
                     <input type="reset" value="Refazer" class="reset_button" />
                  </td>
                  <td align="center">
                     <input type="submit" value="Remover" class="bSubmit_removeMac" />
                  </td>
                  <td></td>
               </tr>
            </table>
			</form>
			<br/>
			<hr class="separate_line">
			<%

			  try {

				  PasswordDelMac lastDay = PasswordDelMac.getInstance().selectLastData();
				  DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");

			%>
			<center>
				<span style="text-align: left; padding-right: 150px; color: gray; font-weight: bold;">
	    Data da última senha criada: <span class="begin_day"><%=dateFormat.format(lastDay.getData_creation())%></span></span>
				<span style="text-align: center; padding-right: 150px; color: gray; font-weight: bold;">
	    Data de expiração: <span class="last_day"><%=dateFormat.format(lastDay.getData_remove())%></span></span>

				<%
				Date dataAtual = new Date();
				dateFormat.format(dataAtual);
				lastDay = PasswordDelMac.getInstance().selectDaysRemaining();

				%>
				<span style="text-align: right; padding-right: 150px; color: gray; font-weight: bold;">Dias para expirar:
					<span class="days_remaining">&nbsp;<%=lastDay.getDaysRemaining()%>&nbsp;</span></span>
				<br/>
			</center>
			<%
				} catch (Exception e) {
				}
			%>
			<p><br/></p>
      </div>
      <div class="footer_madmac">
			<%@include file="/common_pages/footer.jsp" %>
      </div>
   </body>
</html>